package com.xbongbong.pro.statistic.result.pojo;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * 标题pojo（如目标完成情况标题、穿透后标题）
 * @author zcp
 * @version v1.0
 * @date 2019/4/1 20:11
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class TitlePojo implements Serializable {
    private static final long serialVersionUID = -358717807711031541L;

    /**
     * 字段英文key名，值主要有：
     * "name"---员工的英文key
     * "depName"---员工的英文key
     * "id_14"---指标的英文key，命名规则："id_" + 指标id
     */
    private String key;
    /**
     * 以上key值对应的中文名，值主要有：
     * "姓名"
     * "部门"
     * "签约合同数1目标完成情况/单位：个"
     */
    private String value;
    /**
     * 该列字段类型，默认不传，一些特殊字段需要特殊标明，如星级@see FieldTypeEnum
     */
    private Integer filedType;
    /**
     * 是否靠右：0，靠左 1，靠右 2，居中
     */
    private Integer numRight;

    /**
     * child主要封装三项：目标值、完成值、完成率
     * value分别为："目标值"，"完成值"，"完成率"
     * key分别为：（最后面的数字是指标id）
     * "target_id_14"
     * "finish_id_14"
     * "rate_id_14"
     */
    private List<TitlePojo> child;

    /**
     * 特殊符号标志，比如@符号
     */
    private Integer specialSymbol;

    public TitlePojo(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public TitlePojo(String key, String value, Integer filedType) {
        this.key = key;
        this.value = value;
        this.filedType = filedType;
    }

    public TitlePojo(String key, String value, Integer filedType, Integer numRight) {
        this.key = key;
        this.value = value;
        this.filedType = filedType;
        this.numRight = numRight;
    }

    /**
     * 以下是建造者模式方法
     *
     * @param builder
     */
    public TitlePojo(Builder builder) {
        this.key = builder.key;
        this.value = builder.value;
        this.specialSymbol = builder.specialSymbol;
        this.filedType = builder.fieldType;
    }

    public static class Builder{
        private String key;
        private String value;
        private Integer specialSymbol;
        private Integer fieldType;
        public Builder key(String key){
            this.key = key;
            return this;
        }
        public Builder value(String value){
            this.value = value;
            return this;
        }
        public Builder specialSymbol(Integer specialSymbol){
            this.specialSymbol = specialSymbol;
            return this;
        }
        public Builder fieldType(Integer fieldType){
            this.fieldType = fieldType;
            return this;
        }
        public TitlePojo build(){
            return new TitlePojo(this);
        }
    }

}
